//
//  FindPassWordViewController.m
//  cityStar
//
//  Created by joyban on 15-1-14.
//  Copyright (c) 2015年 tiny. All rights reserved.
//

#import "FindPassWordViewController.h"

@interface FindPassWordViewController ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *telphone;
@property (weak, nonatomic) IBOutlet UITextField *passWord;
@property (weak, nonatomic) IBOutlet UITextField *SecendPassWord;

@end

@implementation FindPassWordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"找回密码";
    [self addBackButton];
    self.telphone.placeholder = @"手机验证码";
    self.passWord.placeholder = @"请输入新密码";
    self.SecendPassWord.placeholder = @"请重复输入新密码";
    
    self.telphone.returnKeyType = UIReturnKeyDone;
    self.telphone.delegate = self;
    self.passWord.returnKeyType = UIReturnKeyDone;
    self.passWord.delegate = self;
    self.SecendPassWord.returnKeyType = UIReturnKeyDone;
    self.SecendPassWord.delegate = self;}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}

#pragma - mark textDeletage

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    return YES;
}


- (IBAction)Yangzheng_Action:(id)sender
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"发送成功" delegate:self cancelButtonTitle:@"确认" otherButtonTitles: nil];
    [alert show];
}

- (IBAction)Return_Action:(id)sender
{
    if([self.telphone.text isEqualToString:@""])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"验证码不能为空" delegate:self cancelButtonTitle:@"确认" otherButtonTitles: nil];
        [alert show];
    }else if([self.passWord.text isEqualToString:@""])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"新密码不能为空" delegate:self cancelButtonTitle:@"确认" otherButtonTitles: nil];
        [alert show];
    }else if ([self.SecendPassWord.text isEqualToString:@""])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"再一次输入密码不能为空" delegate:self cancelButtonTitle:@"确认" otherButtonTitles: nil];
        [alert show];
    }else if(![self.passWord.text isEqualToString: self.SecendPassWord.text])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"两次输入的密码不一致空" delegate:self cancelButtonTitle:@"确认" otherButtonTitles: nil];
        [alert show];
    }else{
        
    }
    
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.telphone resignFirstResponder];
    [self.passWord resignFirstResponder];
    [self.SecendPassWord resignFirstResponder];
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
